﻿CREATE FUNCTION [dbo].[laydanhmucmenuhienthitheonhom]          
(           
 @MaNhom as int          
)          
RETURNS TABLE           
AS          
RETURN           
(          
select b.TenMenu as MenuName,b.Hinh,          
cast(b.TenModule as nvarchar(200))+'.'+cast(b.TenThuMuc as nvarchar(200))+'.'+cast(b.TenForm as nvarchar(200))+'!!!!!'+        
b.TenForm+'%%%%%'+b.TenModule+'&&&&&'+cast(a.ID as nvarchar(200))+'^^^^^'+CAST(a.IDCN as nvarchar(200)) as ChuoiMenu,          
a.Cap as CapMenu,a.MenuCha as MenuParent,b.MenuID as ID  ,ThuTuXuatHien        
from QuanTri_PhanNhomMenu a,DanhMuc_Menu b          
where a.MenuID=b.MenuID and MaNhomMenuND=@MaNhom   and (a.Quyen_Xem=1  or a.Quyen_Xoa=1 or a.Quyen_CapNhat=1 )    
          
) 